﻿using MoviesWeb.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["inf"] = null;
        }
    }
    protected void bt_login_Click(object sender, EventArgs e)
    {
        if (RequiredFieldValidator1.IsValid && RequiredFieldValidator2.IsValid)
        {
            string account = admin_id.Text.Trim();
            string pwd = password.Text.Trim();
            if (ManagerBLL.Login(account, pwd))
            {
                ManagerBLL.ChangeLostLoginTime(account);
                FormsAuthentication.SetAuthCookie(account, false);
                Response.Redirect("~/Admin/admininf.aspx",false);
                //ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>ShowMessage('登陆成功!')</script>");
                Response.Write("<script>alert('登陆成功!')  </script>");
            }
            else
                Response.Write("<script>alert('登陆失败!')  </script>");
                //ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>ShowMessage('登陆失败!')</script>");
        }
    }
}